fix: resolve copilot/ provider prefix in model AIC lookup#37340
Merged
Conversation
Token-usage.jsonl entries from the Copilot engine use model names like "copilot/claude-sonnet-4.6" (with an embedded "copilot/" prefix) or set provider="copilot". Neither matched the catalog entry "github-copilot/claude-sonnet-4.6", causing computeInferenceAIC() to return 0 and the agent AIC footer to be blank. Fix by: 1. Adding "copilot" as an alias for "github-copilot" in normalizeProvider() 2. Normalizing the embedded provider prefix in findModelPricing() when the model name contains a "/" separator Effective tokens were unaffected because computeEffectiveTokens() falls back to base-weighted-tokens when pricing is not found; AIC has no such fallback, so it stayed at 0. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
fix: resolve copilot/ provider prefix in model AIC lookup
fix: resolve Jun 6, 2026
copilot/ provider prefix in model AIC lookup
Copilot created this pull request from a session on behalf of
pelikhan
June 6, 2026 15:56
View session
pelikhan
approved these changes
Jun 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes AI Credits (AIC) computation for Copilot engine runs by ensuring model pricing lookup correctly handles model IDs logged with a copilot/ provider prefix, aligning them with the pricing catalog’s github-copilot/ IDs.
Changes:
- Extend provider normalization to treat
copilotas an alias ofgithub-copilot. - Normalize embedded provider prefixes in
modelstrings likecopilot/<model>before catalog lookup. - Add tests covering both
provider="copilot"with a bare model name andmodel="copilot/..."with an empty provider.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/model_costs.cjs | Normalizes copilot → github-copilot and normalizes embedded provider prefixes when constructing the catalog lookup ID. |
| actions/setup/js/model_costs.test.cjs | Adds regression tests to ensure Copilot-prefixed model names resolve pricing and produce non-zero AIC. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This was referenced Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent AIC was always 0 for Copilot engine runs, so the generated issue footer showed only the threat-detection AIC (e.g.
⌖ 19.2 AIC) with no agent contribution.Root cause: The Copilot engine logs model names as
copilot/claude-sonnet-4.6intoken-usage.jsonl.findModelPricing()compared this directly against the catalog IDgithub-copilot/claude-sonnet-4.6— a mismatch — so pricing lookup returnednull,computeInferenceAIC()returned 0, and theaicstep output was never set. Effective tokens were unaffected becausecomputeEffectiveTokens()has a raw-token fallback; AIC does not.Changes (
model_costs.cjs):normalizeProvider: adds"copilot"as an alias for"github-copilot"(alongside the existing"github"alias)findModelPricing: when the model name contains/, normalizes the embedded provider prefix before constructing the catalog IDTests (
model_costs.test.cjs):provider="copilot"+ bare model name andmodel="copilot/..."+ empty provider